# -*- coding: utf-8 -*-
# @Time    : 2024/2/1 20:53
# @Author  : micah
# @File    : 6.通过js脚本控制浏览器.py
# @Software: PyCharm

import time
from selenium import webdriver


browser = webdriver.Chrome()
browser.get('https://www.taobao.com')
time.sleep(1)

js_code = 'window.open("https://www.bing.com")'
browser.execute_script(js_code)  # 新建标签页

time.sleep(2)

browser.close()
